package com.pojoin.cms.service.impl;

import java.util.List;

import com.pojoin.cms.dao.ResourceDao;
import com.pojoin.cms.domain.Resource;
import com.pojoin.cms.service.ResourceService;

public class ResourceServiceImpl implements ResourceService {
	
	private ResourceDao resourceDao;
	
	public ResourceDao getResourceDao() {
		return resourceDao;
	}
	public void setResourceDao(ResourceDao resourceDao) {
		this.resourceDao = resourceDao;
	}


	@Override
	public List<Resource> getAllResources() {
		return this.resourceDao.getAllResources();
	}
	@Override
	public Resource add(Resource resource) {
		if(this.resourceDao.isExist(resource)){
			return null;
		}
		return this.resourceDao.add(resource);
	}
	@Override
	public Resource findById(Long resourceId) {
		return this.resourceDao.findById(resourceId);
	}

}
